package github.leavesczy.reactivehttpsamples.core.http

import github.leavesczy.reactivehttpsamples.core.mode.BridgeRecordData
import github.leavesczy.reactivehttpsamples.core.mode.BridgeRecordItem
import github.leavesczy.reactivehttpsamples.core.mode.BridgeWrapMode
import github.leavesczy.reactivehttpsamples.core.mode.DistrictMode
import github.leavesczy.reactivehttpsamples.core.mode.DistrictsWrapMode
import github.leavesczy.reactivehttpsamples.core.mode.ForecastsMode
import github.leavesczy.reactivehttpsamples.core.mode.ForecastsWrapMode
import github.leavesczy.reactivehttpsamples.core.mode.MeasureFileSerialNumData
import github.leavesczy.reactivehttpsamples.core.mode.MeasureModelBodyData
import github.leavesczy.reactivehttpsamples.core.mode.MeasureModelNumData
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.PartMap
import retrofit2.http.Query

/**
 * @Author: leavesCZY
 * @Date: 2020/2/25 16:34
 * @Desc:
 * @Github：https://github.com/leavesCZY
 */
interface ApiService {

    @GET("config/district")
    suspend fun getProvince(): DistrictsWrapMode<List<DistrictMode>>

    @GET("config/district")
    suspend fun getCity(@Query("keywords") keywords: String): DistrictsWrapMode<List<DistrictMode>>

    @GET("config/district")
    suspend fun getCounty(@Query("keywords") keywords: String): DistrictsWrapMode<List<DistrictMode>>

    @GET("weather/weatherInfo?extensions=all")
    suspend fun getWeather(@Query("city") city: String): ForecastsWrapMode<List<ForecastsMode>>

    @GET("config/district")
    suspend fun mustFailed(): DistrictsWrapMode<List<String>>

    @POST("mobile/bridge/listByPage")
    suspend fun requireBridgeListPage(@Body body: RequestBody):BridgeWrapMode<BridgeRecordData>

    @Multipart
    @POST("mobile/bridge/addMeasureModel")
    suspend fun requireAddMeasureModel(@Part file:MultipartBody.Part, @PartMap params: MutableMap<String,RequestBody>):BridgeWrapMode<Any>

    @POST("mobile/bridge/analysis")
    suspend fun requireBridgeAnalysis(@Body body: RequestBody):BridgeWrapMode<BridgeRecordItem>

    @POST("mobile/bridge/getMeasureModelNum")
    suspend fun requireGetMeasureModelNum(@Body body: RequestBody):BridgeWrapMode<MeasureModelNumData>

    @POST("mobile/bridge/add")
    suspend fun requireBridgeAdd(@Body body: RequestBody):BridgeWrapMode<Any>

    @POST("mobile/bridge/delete")
    suspend fun requireBridgeDelete(@Body body: RequestBody):BridgeWrapMode<Any>

    @POST("mobile/bridge/measure/listAll")
    suspend fun requireBridgeMeasureList(@Body body: RequestBody):BridgeWrapMode<MeasureModelBodyData>

    @POST("mobile/bridge/getMeasureFileSerialNum")
    suspend fun requestMeasureFileSerialNum(@Body body: RequestBody):BridgeWrapMode<MeasureFileSerialNumData>

    @POST("mobile/bridge/detail")
    suspend fun requireBridgeDetail(@Body body: RequestBody):BridgeWrapMode<BridgeRecordItem>

    @POST("pc/bridge/resetResult")
    suspend fun requireBridgeResetResult(@Body body: RequestBody):BridgeWrapMode<Any>
}